<?php
	require_once('_inc.php');



	if( $_GET['out'] ) {
		D::$user->out();
		die("<script type=\"text/javascript\">alert(\"退出系统完成!\"); location = './index.php' ;</script>");
	}

	if(  D::$request->isPOST()){ // $_GET['PHPSESSID'] 
		$U	= D::$db->one("SELECT * FROM  user WHERE sName=". D::$db->quote($_POST['sName']) );
		$return	= array();
		if( empty($U)  || $U['sPasswd']	!== $_POST['sPasswd']){
			$return['success']	= false;
			$return['msg']		= '登录失败！';
		}else{
			$return['success']	= true;
			$return['uid']		= $U['id'];
			D::$user->in($U['id']);
		}		
		echo json_encode($return);
		die;
	}

	$tpl	= new tpl();

	$tpl->display(B_DIR .'/login.tpl.htm');


?>